// Header: 定时器1s
// File Name: Timer0
// Author: pu
// Date: 2022/11/06
#include <REGX52.H>

void Timer0_init()
{
	//	TMOD = 0x01;  //选择定时器1,不影响高四位而配置低四位
	TMOD &= 0XF0;
	TMOD |= 0X01;
	//TCON 可以位寻址
	TF0 = 0; 
	TR0 = 1;
//	TH0 = 65435/256; 
//	TL0 = 65435%256;
	TL0 = 0X18;
	TH0 = 0XFC;
	//中断
	ET0 = 1;
	PT0 = 0;
	EA = 1;
}
/*
void Timer0_Routine() interrupt 1
{
	static unsigned int Timer_Count;
	TL0 = 0X18;
	TH0 = 0XFC;
	Timer_Count++;
	if (Timer_Count >= 1000)
	{
		Timer_Count = 0;
	}
}
*/